#include <aura.h>

//#define Dir "/tmp/TestCriticalSectiontt"

Aura_Bool AuraTest_CriticalSection()
{
    Aura_WaitResult result;
    Aura_Handle hCriticalSection;
    //Aura_WChar wtmp[128];

    //AnsiToUnic(wtmp, Dir);
    AuraCriticalSection_Create(&hCriticalSection);
    Aura_ECode ec = AuraCriticalSection_Enter(hCriticalSection);
    if(AURA_FAILED(ec)){
        Aura_printf("AURA_FAILED lock.\n");
        return AURA_FALSE;
    }

    Aura_printf("Enter the CriticalSection\n");
    AuraThread_Sleep(1000, &result);
    Aura_printf("Leave the CriticalSection\n");
    AuraCriticalSection_Leave(hCriticalSection);

    AuraCriticalSection_Destroy(hCriticalSection);
    return AURA_TRUE;
}

